/*
 * @Author: trk trk990920@163.com
 * @Date: 2022-02-12 12:01:14
 * @LastEditors: trk trk990920@163.com
 * @LastEditTime: 2022-07-18 15:04:18
 * @Description: 
 */
import type { AppRouteRecordRaw } from '@/router/types';
import Layouts from '@/layouts/default/index.vue'
import {
  LoginRoute,
  PageNotFoundRoute,
  RedirectRoute
} from '@/router/routes/basicRoutes';

export const dashboardRoutes: AppRouteRecordRaw = {
  name: 'dashboard',
  path: '/',
  redirect: '/dashboard',
  component: Layouts,
  meta: {
    title: 'dashboard'
  },
  children: [
    {
      name: 'dashboard',
      path: 'dashboard',
      component: () => import('@/views/dashboard/index.vue'),
      meta: {
        title: 'dashboard',
        icon: 'menuDashboard',
        affix: true
      }
    }
  ]
};

// Basic routing without permission
export const basicRoutes = [
  dashboardRoutes,
  PageNotFoundRoute,
  RedirectRoute,
  LoginRoute
];

const modules = import.meta.globEager('./modules/*.ts')
const asyncRoutes: any[] = []
Object.keys(modules).forEach((key) => {
  asyncRoutes.push(...modules[key].default)
})

export { asyncRoutes }
